package 深入反射机制.反射属性Field.反编译属性.test01;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ResourceBundle;

public class ReflectTest01 {
    public static void main(String[] args) {
        StringBuffer s = new StringBuffer();

        ResourceBundle bundle = ResourceBundle.getBundle("invincibleConfiguration");
        Class studentClass = null;
        try {
            studentClass = Class.forName(bundle.getString("completeClassName"));
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        //Class studentClass = Integer.class;

        s.append(Modifier.toString(studentClass.getModifiers()) + " class " + studentClass.getSimpleName() + " {\n");
        Field[] fieldAll = studentClass.getDeclaredFields();

        for (Field field : fieldAll){
            s.append("\t");
            s.append(Modifier.toString(field.getModifiers()));
            s.append(" ");
            s.append(field.getType().getSimpleName());
            s.append(" ");
            s.append(field.getName());
            s.append(";\t\n");
            //s.append("\n" + "\t" + Modifier.toString(field.getModifiers()) + " " + field.getType().getSimpleName() + " " + field.getName() + ";" + "\t" + "\n");
        }

        s.append("}");
        System.out.println(s);
    }
}

















